# -*- coding=utf-8
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
import sys
import logging
from s25day01 import settings

logging.basicConfig(level=logging.INFO, stream=sys.stdout)
secret_id = settings.TENCENT_COS_ID  # 替换为用户的 secretId
secret_key = settings.TENCENT_COS_KEY  # 替换为用户的 secretKey
region = 'ap-guangzhou'  # 替换为用户的 Region

config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
# 2. 获取客户端对象
client = CosS3Client(config)

response = client.upload_file(
    Bucket='miaojiaxi-1304867879',
    LocalFilePath='秋水.jpg',
    Key='p1.jpg',
)
print(response['ETag'])
